﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MediaPlayerUC
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private MediaClock clock = null;

        public MainWindow()
        {
            InitializeComponent();
            this.mediaElement1.Clock = Med
            clock = new MediaClock();
            clock.Completed += new EventHandler(clock_Completed);
            clock.CurrentGlobalSpeedInvalidated += new EventHandler(clock_CurrentGlobalSpeedInvalidated);
            clock.CurrentStateInvalidated += new EventHandler(clock_CurrentStateInvalidated);
            clock.CurrentTimeInvalidated += new EventHandler(clock_CurrentTimeInvalidated);            
        }

        void clock_CurrentTimeInvalidated(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("clock_CurrentTimeInvalidated");
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            this.mediaElement1.Volume = 1;
            this.mediaElement1.Source = new Uri(@"C:\\Users\\Public\\Music\\Sample Music\\Kalimba.mp3");
            //this.mediaElement1.Play();
            this.mediaElement1.Clock = clock;
            this.mediaElement1.Play();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            this.mediaElement1.Stop();
        }

        private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            
        }

        void clock_CurrentStateInvalidated(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("clock_CurrentStateInvalidated");
        }

        void clock_CurrentGlobalSpeedInvalidated(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("clock_CurrentGlobalSpeedInvalidated");
        }

        void clock_Completed(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("clock_Completed");
        }

        private void mediaElement1_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("mediaElement1_ManipulationDelta");
        }
    }
}
